Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bias_dets.py #427

Merged
merged 1 commit into from
Jun 6, 2024
Merged

Update bias_dets.py #427

merged 1 commit into from
Jun 6, 2024

Conversation

dpdutcher
Copy link
Collaborator

@dpdutcher dpdutcher commented Jun 5, 2024

In biasstep_rebias: it should be cfg.dev.exp, not cfg.dev.experiment

In biasstep_rebias: it's `cfg.dev.exp`, not `cfg.dev.experiment`
@dpdutcher dpdutcher requested a review from yuhanwyhan June 5, 2024 21:02
@msilvafe
Copy link
Contributor

msilvafe commented Jun 6, 2024

I'm a bit confused why you needed this change. The device config code loads everything in the experiment section of the dev_cfg yaml into cfg.exp:

class DeviceConfig:
"""
Configuration object containing all "device" specific information. That is,
parameters that will probably change based on which test-bed you are
using and what hardware is loaded into that test-bed. Device configuration
info is split into three groups: ``experiment``, ``bias_groups`` and
``bands``.
The ``experiment`` group contains data that is relevant to the whole
experiment, e.g. the tunefile that should be loaded or the amplifier
currents and voltages that should be set.
The ``bias_groups`` group contains data for each individual bias group.
For instance this is where the bias_high/low/step values are stored for each
bias group.
The ``bands`` group contains data for each individual band. For instance,
the dc_att and drive values.
Attributes:
exp (dict):
Dict with ``experiment`` config options
bias_groups (list):
List of 12 bias group configuration dictionaries.
bands (list):
List of 8 band configuration dictionaries.
"""
def __init__(self):
self.load_defaults()
self.source_file = None
def load_defaults(self):
self.bands = [band_defaults.copy() for _ in range(8)]
self.bias_groups = [bg_defaults.copy() for _ in range(12)]
self.exp = exp_defaults.copy()
@classmethod
def from_dict(cls, data):
"""
Creates a DeviceConfig object from a dictionary.
"""
self = cls()
for k, v in data['bands'].items():
if k.lower().startswith('amc'): # Key formatted like AMC[i]
amc_index = int(k[4])
self._load_amc(amc_index, v)
if k.lower().startswith('band'): # Key formatted like Band[i]
band_index = int(k[5])
self.bands[band_index].update(v)
# Loads bias groups from config file
for i, bg in enumerate(self.bias_groups):
for k, vlist in data['bias_groups'].items():
self.bias_groups[i][k] = vlist[i]
# Loads experiment config data
self.exp.update(data['experiment'])
return self

@dpdutcher
Copy link
Collaborator Author

cfg.dev does not have an "experiment" attribute, it only has a "exp" attribute.
So sleep_time = cfg.dev.experiment["overbias_sleep_time_sec"] fails with an attribute error.

@msilvafe
Copy link
Contributor

msilvafe commented Jun 6, 2024

cfg.dev does not have an "experiment" attribute, it only has a "exp" attribute.

So sleep_time = cfg.dev.experiment["overbias_sleep_time_sec"] fails with an attribute error.

Ahh ok I read this wrong I thought you were changing exp -> experiment not the other way around.

@dpdutcher dpdutcher requested a review from msilvafe June 6, 2024 14:25
Copy link
Contributor

@msilvafe msilvafe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for testing and catching this.

@dpdutcher dpdutcher merged commit 8c0d293 into master Jun 6, 2024
1 check passed
@dpdutcher dpdutcher deleted the dpdutcher-patch-1 branch June 6, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants